<!DOCTYPE html>
<html>
<head>
    <include file="Include:meta"/>
    <title>编辑项目-目的地运营集团数据管理平台</title>
    <include file="Include:style"/>
    <style>
        .w50 {
            width: 50px;
        }
    </style>
</head>
<body>
<include file="Include:header"/>
<include file="Include:left"/>
<div id="main">
    <div class="crumbs">
        <div class="crumbs-text">项目列表 > 编辑项目</div>
    </div>
    <div id="content">
        <form action="__APP__/CrmProject/edit" method="post" id="crmproject_add_form">
            <div class="form-main">
                <input hidden name="project_id" value="{$project_id}">
                <div class="form-title">编辑项目</div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>关联需求</div>
                    <div class="input-item">
                        <input type="hidden" name="information_id" value="{$information['information_id']}">
                        <input type="text" class="form-control w200" value="{$information['customer_name']}"
                               autocomplete="off" required readonly>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目名称</div>
                    <div class="input-item">
                        <input type="text" class="form-control w400" name="name" value="{$result['name']}"
                               autocomplete="off" required>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目简称</div>
                    <div class="input-item">
                        <input type="text" class="form-control w200" name="short_name" value="{$result['short_name']}"
                               autocomplete="off" required>
                        <span class="error-item">必填项</span>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>负责人</div>
                    <div class="input-item">
                        <select name="leader" class="form-control w200 required_select" autocomplete="off"
                                required>
                            <option value="">请选择</option>
                            <foreach name="user_list" item="vo">
                                <option value="{$vo.id}"
                                <if condition="$result['leader'] eq $vo['id']">selected</if>
                                >{$vo.username}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目性质</div>
                    <div class="input-item">
                        <select name="nature" class="form-control w200 required_select" autocomplete="off"
                                required>
                            <option value="">请选择</option>
                            <for start="1" end="5">
                                <option value="{$i}"
                                <if condition="$result['nature'] eq $i">selected</if>
                                >{:get_nature($i)}</option>
                            </for>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目类型</div>
                    <div class="input-item">
                        <select name="type[]" class="form-control w200 required_select" multiple='multiple'
                                required>
                            <option value="">请选择</option>
                            <for start="1" end="7">
                                <option value="{$i}"
                                <foreach name="types" item="vo">
                                    <if condition="$i eq $vo">selected</if>
                                </foreach>
                                >{:get_project_type($i)}</option>
                            </for>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目阶段</div>
                    <div class="input-item">
                        <select name="stage" class="form-control w200 required_select" autocomplete="off"
                                disabled>
                            <option value="{$result['stage']}">{:get_project_stage($result['stage'])}</option>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">重要程度</div>
                    <div class="input-item">
                        <for start="1" end="5">
                            <label class="radio-inline" for="importance{$i}">
                                <input type="radio" name="importance" id="importance{$i}" value="{$i}"
                                <if condition="$result['importance'] eq $i">checked</if>
                                >{:get_project_importance($i)}
                            </label>
                        </for>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目规模</div>
                    <div class="input-item">
                        <select name="size" class="form-control w200 required_select" autocomplete="off"
                                required>
                            <option value="">请选择</option>
                            <for start="1" end="6">
                                <option value="{$i}"
                                <if condition="$result['size'] eq $i">selected</if>
                                >{:get_project_size($i)}</option>
                            </for>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">项目网站</div>
                    <div class="input-item">
                        <input type="text" class="form-control w200" name="website" value="{$result['website']}"
                               placeholder="http://" autocomplete="off">
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">项目地址</div>
                    <div class="input-item">
                        <select name="province_id" class="form-control w100" autocomplete="off">
                            <option value='-10'>省</option>
                            <foreach name="province_list" item="vo">
                                <option value="{$vo['id']}"
                                <if condition="$result['province_id'] eq $vo['id']">selected</if>
                                >{$vo['name']}</option>
                            </foreach>
                        </select>
                        <select name="city_id" class="form-control w100" autocomplete="off">
                            <option value='-10'>市</option>
                            <foreach name="city_list" item="vo">
                                <option value="{$vo['id']}"
                                <if condition="$result['city_id'] eq $vo['id']">selected</if>
                                >{$vo['name']}</option>
                            </foreach>
                        </select>
                        <input type="text" name="address" class="form-control w380" placeholder="详细地址（可不填）"
                               autocomplete="off" value="{$result['address']}">
                        <span class="error-item"></span>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">公司名称</div>
                    <div class="input-item">
                        <span><input type="text" class="form-control w200" name="company_name"
                                     value="{$result['company_name']}"
                                     autocomplete="off"></span>
                        <span>公司性质
                            <select name="company_nature" class="form-control w200 required_select" autocomplete="off">
                                <option value="政府"<if
                                    condition="$result['company_nature'] eq '政府'">selected</if>>政府</option>
                                <option value="民营"<if
                                    condition="$result['company_nature'] eq '民营'">selected</if>>民营</option>
                                <option value="国企"<if
                                    condition="$result['company_nature'] eq '国企'">selected</if>>国企</option>
                                <option value="合资"<if
                                    condition="$result['company_nature'] eq '合资'">selected</if>>合资</option>
                                <option value="外资"<if
                                    condition="$result['company_nature'] eq '外资'">selected</if>>外资</option>
                        </select></span>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目简介</div>
                    <div class="input-item">
                        <textarea class="form-control w400" name="intro"
                                  autocomplete="off" required>{$result['intro']}</textarea>
                        <br>
                        <span style="color: grey">（包含项目区位，面积，资源，规模，接待量等信息）</span>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>合作诉求</div>
                    <div class="input-item">
                        <textarea class="form-control w400" name="work_demands" autocomplete="off" required>{$result['work_demands']}</textarea>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>甲方背景</div>
                    <div class="input-item">
                        <textarea class="form-control w400" name="backdrop"
                                  autocomplete="off" required>{$result['backdrop']}</textarea>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目预判</div>
                    <div class="input-item">
                        <textarea class="form-control w400" name="prognosis"
                                  autocomplete="off" required>{$result['prognosis']}</textarea>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">备注</div>
                    <div class="input-item">
                        <textarea name="remark" class="form-control w400"
                                  autocomplete="off">{$result['remark']}</textarea>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>添加主要联系人</div>
                    <div class="input-item">
                        <select name="main_linkman" class="form-control w200"
                                autocomplete="off" required>
                            <option value="">请选择</option>
                            <foreach name="res_crm_contact" item="vo">
                                <option value="{$vo['contact_id']}"
                                <if condition="$result['main_linkman'] eq $vo['contact_id']">selected</if>
                                >{$vo['username']}-{$vo['mobilephone']}</option>
                            </foreach>
                        </select>
                        <button type="button" class="btn add_cus">添加客户</button>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">添加其他联系人</div>
                    <div class="input-item">
                        <select name="other_linkman[]" id="other_linkman" multiple='multiple' class="form-control w400"
                                autocomplete="off">
                            <foreach name="res_crm_contact" item="vo">
                                <option value="{$vo['contact_id']}"
                                <foreach name="other_linkman_ids" item="v">
                                    <if condition="$v eq $vo['contact_id']">selected</if>
                                </foreach>
                                >{$vo['username']}-{$vo['mobilephone']}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
            </div>
            <div class="form-btn-item"><input type="submit" value="提交" class="btn btn-submit">
                <button class="btn btn-default goback" type="button">返回</button>
            </div>
        </form>
    </div>
</div>
<!--弹出框-->
<include file="Crm:contact_ajax_add"/>
</body>
<include file="Include:javascript"/>
<include file="Crm:javascript_contact"/>
<script>
    $(function () {
        /*省市联动*/
        $("[name='province_id']").change(function () {
            var id = $(this).val();
            $.ajax({
                type: "POST",
                dataType: 'json',
                data: {'region': id, 'type': 1, 'bool': 1},
                url: "__APP__/Communal/get_province_city",
                success: function (data) {
                    var option = "";
                    if (data) {
                        option += "<option value='-10'>请选择</option>";
                        if (data) {
                            for (var i = 0; i < data.length; i++) {
                                option += "<option value=" + data[i].id + ">" + data[i].name + "</option>";
                            }
                        }
                    } else {
                        option += "<option value='-10'>市</option>";
                    }
                    $("[name='city_id']").html(option).select2();
                }
            });
        });
    });
</script>
</html>